home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 551-575 / disk_559 / apig / apiglib_v11.lzh / e1_window.rexx < prev    next >
OS/2 REXX Batch file  |  1991-09-28  |  4KB  |  137 lines

  1.  
  2. /* This example simply opens and closes a window, writes to window console  */
  3.  
  4.  
  5. /*  add library */
  6.  
  7. x = addlib("apig.library",0,-30,0)
  8.  
  9. portname = "example1_port"   /* this is the name of the port that */
  10.                              /* intuimessages will be sent to     */
  11.                              
  12. p = openport(portname)       /* create the port                   */
  13.  
  14. call set_apig_globals()      /* initialize INTUITION constants    */
  15.  
  16. WaitForPort portname         /* this port should be here by now   */
  17.  
  18. scr = 0 
  19.  
  20. wintitle = "This is your Window title"
  21.  
  22. winidcmp = CLOSEWINDOW       /* the INTUI-Events you want the window */
  23.                              /* to receive                           */
  24.                              
  25. /* set window flags for system gadgets and type of window you want   */
  26. winflags = WINDOWCLOSE+WINDOWDRAG+WINDOWSIZING+WINDOWDEPTH+GIMMEZEROZERO
  27.  
  28. /*  open window, since scr = 0 the window opens on WorkBench screen  */
  29. /*  this window is opened with a console attached */
  30.  
  31. win = openwindow(portname,0,0,640,200,2,4,winidcmp,winflags,wintitle,scr,1,0,0)
  32.  
  33. wrastport = getwindowrastport(win)  /* need rastport to do graphics/itext */
  34.  
  35. teststring = "A test of writing to windows console "
  36. do i = 1 to 15
  37.    z = writeconsole(win,(i teststring || '0a'x))
  38. end
  39.  
  40. z = writeconsole(win,'0a'x)
  41. z = writeconsole(win,'0a'x)
  42. z = writeconsole(win,'0a'x)
  43.  
  44. z = writeconsole(win,teststring)
  45. wait 2 secs
  46. do i = 1 to length(teststring)
  47.    z = writeconsole(win,'0820'x)  /* this is a backspace and space */
  48.    z = writeconsole(win,'08'x)  
  49. end
  50.  
  51. do i = 1 to length(teststring)
  52.    z = writeconsole(win,substr(teststring,i,1))
  53. end
  54. wait 1 secs
  55. do i = 1 to length(teststring)
  56.    z = writeconsole(win,'0820'x)
  57.    z = writeconsole(win,'08'x)  
  58. end
  59.  
  60. z = writeconsole(win,"Im gonna go delete a line")
  61. wait 1 sec
  62. do i = 1 to 9
  63.   z = writeconsole(win,'9b46'x)    /* move up 1 line */
  64. end
  65.  
  66. z = writeconsole(win,'9b4d'x)    /* delete line */
  67.  
  68. wait 1 sec
  69. z = writeconsole(win,'9b4c'x)    /* insert line */
  70. z = writeconsole(win,"Just wanted to insert this ")
  71.  
  72.  
  73.  
  74. /* ------------------------------- */
  75.  
  76. wait 1 secs
  77. z = clearscreen(wrastport,0,0)
  78.  
  79. do i = 10 to 190 by 11
  80.    z = pitext(wrastport,10,i,"This is a test",1,2,JAM2,0)
  81. end
  82.  
  83. wait 1 secs
  84. z = clearscreen(wrastport,0,0)
  85.  
  86. z = clearscreen(wrastport,0,0)
  87. z = pitext(wrastport,170,60,"Im Done ... Close the Window",1,2,JAM2,0)
  88.  
  89. say " Windows Left Edge " windowinfo(win,1)   
  90. say " Windows Top Edge " windowinfo(win,2)
  91. say " Windows Width  " windowinfo(win,3)
  92. say " Windows Height " windowinfo(win,4)
  93. say " Windows MouseY " windowinfo(win,5)
  94. say " Windows MouseX " windowinfo(win,6)
  95. say " Windows MinWidth " windowinfo(win,7)
  96. say " Windows MinHeight " windowinfo(win,8)
  97. say " Windows MaxWidth " windowinfo(win,9)   
  98. say " Windows MaxHeight " windowinfo(win,10)
  99. say " Windows Flags " windowinfo(win,11)
  100. say " Windows Requester count " windowinfo(win,12)
  101. say " Windows Border Left " windowinfo(win,13)     
  102. say " Windows Border Top " windowinfo(win,14)
  103. say " Windows Border Right " windowinfo(win,15)
  104. say " Windows Border Bottom " windowinfo(win,16)
  105. say " Windows IDCMP Flags " windowinfo(win,17)
  106. say " Windows Detail Pen " windowinfo(win,18)
  107. say " Windows Block Pen " windowinfo(win,19)
  108. say " Windows GZZMouseY " windowinfo(win,20)
  109. say " Windows GZZMouseX " windowinfo(win,21)
  110. say " Windows GZZWidth " windowinfo(win,22)
  111. say " Windows GZZHeight " windowinfo(win,23)        
  112.  
  113. do forever
  114.  
  115.      x = waitpkt(portname)
  116.   
  117.      do forever 
  118.      
  119.         msg = getpkt(portname)
  120.         if msg = '0000 0000'x then leave
  121.         
  122.         class = getarg(msg,0)
  123.         if class = CLOSEWINDOW then exitme = 1
  124.         
  125.         x = reply(msg,0)  
  126.         
  127.      end  
  128.      
  129.    if exitme = 1 then leave
  130.    
  131. end
  132.  
  133.   a = closewindow(win)
  134.   
  135. exit
  136.  
  137.